<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class GameConfigRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'callback_url'  => 'required',
            'key'  => 'required|max:50',
            'app_name' => 'required|max:50',
            'note' => 'max:50'
        ];
    }

    public function messages()
    {
        return [
            'app_name.required' => '请填写游戏名',
            'key.required'  => '请输入游戏简写（key）',
            'key.max'  => '游戏简写最多输入50个字符',
            'callback_url.required'  => '请输入游戏支付回调地址',
            'note.max'  => '备注不能超过50个字符',
            'app_name.max'  => '游戏名称最多输入50个字符',
        ];
    }
}
